﻿using System;

namespace XTengine.ComponentModel
{
    public class DateTimeConverter : TypeConverter<DateTime>
    {
        public override DateTime ConvertFrom(string value)
        {
            DateTime result;
            if (DateTime.TryParse(value, out result))
            {
                return result;
            }

            return default(DateTime);
        }

        public override string ConvertTo(DateTime value)
        {
            return value.ToString();
        }
    }
}